<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>后台主界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/admin.css' type="text/css" />
<script src="<?php echo $static_url; ?>common/js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="<?php echo $static_url; ?>common/js/common.js" type="text/javascript"></script>

<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/daily_record.css' type="text/css" />
<style>
.record_table a {
	border: none;
}
</style>
</head>
<body class="body_background">
	<div>
		<?php echo $header_nav; ?>
		
		<div class="common_container clearfix">
			<div class="crumbs">
				<span class="catalogue">统计代码管理</span>
				<a href="/www/admin/analytic_code/code_lists.php">列表</a> |
				<a href="/www/admin/analytic_code/add_code.php">添加</a>
			</div>
			<div class="daily_record_menu" id="side_container">
				<div class="closeSidebar"><i title="点击隐藏左菜单" class="icon_close"></i></div>
				<ul class="record_menu">
					<li style="font-size:14px;">统计代码列表</li>
					<?php foreach($analytic_codes_rs as $analytic_code): ?>
						<li><a href="/www/admin/analytic_code/edit_code.php?id=<?php echo $analytic_code['id']; ?>">
							 └ <?php echo $analytic_code['title']; ?></a>
						</li>
					<?php endforeach; ?>
				</ul>
			</div>
			<div class="sidebar_container_hidden" style="margin-top:10px;margin-right:5px;"  >
				<div class="openSidebar"><i title="点击显示左菜单" class="icon_open"></i></div>
			</div>
			<div class="daily_record_main" id="main_container">
			<table class="record_tips"><tr><td>统计代码列表</td></tr></table>
				<form id="code_form" action="/www/admin/analytic_code/do/do_order.php" method="post">
				<table class="record_table">
					<thead>
						<tr>
							<th>排序</th>
							<th>ID</th>
							<th>标题</th>
							<th>调用代码</th>
							<th>更新人</th>
							<th>更新时间</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach($analytic_codes_rs as $row): ?>
						<tr>
							<td align="center"><input type="text" name="orders[]" value="<?php echo $row['orders']; ?>" style="width:40px;text-align:center;border:0;"></td>
							<td align="center">
								<?php echo $row['id']; ?>
								<input type="hidden" name="id[]" value="<?php echo $row['id']; ?>" >
							</td>
							<td>
								<a href="/www/admin/analytic_code/edit_code.php?id=<?php echo $row['id']; ?>">
									<?php echo $row['title']; ?>
								</a>
							</td>
							<td align="center">&lt;!--{[analytics_<?php echo $row['id']; ?>]}--&gt;</td>
							<td align="center"><?php echo $row['update_username']; ?></td>
							<td align="center"><?php echo date('Y-m-d H:i:s', $row['updated']); ?></td>
							<td align="center">
								<a href="/www/admin/analytic_code/look_code.php?id=<?php echo $row['id']; ?>">查看</a> |
								<a href="/www/admin/analytic_code/edit_code.php?id=<?php echo $row['id']; ?>">修改</a> |
								<a id="del-<?php echo $row['id']; ?>" href="javascript:del('<?php echo $row['id']; ?>');" onclick="return confirm('确定要删除《<?php echo $row['title'];?>》吗？')" >删除</a>
							</td>
						</tr>
						<?php endforeach; ?>
						<tr>
							<td colspan="6">
								<a href="javascript:;" onclick="document.getElementById('code_form').submit();">排序</a>
							</td>
						</tr>
					</tbody>
				</table>
				</form>
			</div>
		</div>
	</div>
<script>
//删除
function del(i){<!-- i:id号 -->
	$.ajax({
		type: "POST",
		url: "/admin/analytic_code/ajax/ajax_del.php",
		dataType: 'json',
		data: {"id":i},
		beforeSend: function(){
			$('#del-'+i).html( '正在删除' );
		},
		success: function(msg){
			alert(msg.string);
			$('#del-'+i).html( '删除' );
			if(msg.error){
				window.location.href="/www/admin/analytic_code/code_lists.php";
			}
		}
	});
}
</script>
</body>
</html>